<?php

namespace app\controllers\h5\execute;

use app\controllers\h5\base\H5Controller;
use app\models\marketing\MarketingGroup;
use app\models\user\UserAccount;

class CardController extends H5Controller
{
    public function actionFetchCard()
    {
        $set = MarketingGroup::getLastOne();
        $max = $set->card_total;

        $card = UserAccount::find()
            ->where(['user_id' => $this->user->id])
            ->select(['card'])
            ->scalar();

        return $this->successEncode([
            'max' => $max,
            'card' => $card
        ]);
    }
}